<!DOCTYPE html>
<html xmlns:th="www.thymeleaf.org">
<head th:replace="header::head"></head>
<script type="text/javascript">
    var maccms = {"path": "", "mid": "6", "url": "www.scdmfun.cn", "wapurl": "www.cdmfun.cn", "mob_status": "0"};
    var conchtpl = {
        "surl": "/search.html",
        "tipt": "网站公告",
        "tipc": "这里是双辞动漫新站<br><span class='hl-text-conch'>注意事项：</span>1.老站新老站账号不通用<br>老站网址：<span class='hl-text-conch'>dm.scdmfun.cn</span><br>2.如果登录后还是提示未登录请稍等一会再刷新即可<br>动漫闲聊群：<span class='hl-text-conch'>542266218</span>",
        "slink": "https://www.scdmfun.cn/",
        "short": "",
        "api": "0",
        "tok": "",
        "term": "long-term",
        "ver": "3.1"
    }
</script>
<script type="text/javascript" src="/template/conch/asset/js/set/formValidator.js"></script>
<script type="text/javascript" src="/static/js/jquery.imageupload.js"></script>
<title>我的收藏 - 个人中心 - 双辞动漫-专注二次元动漫的小站</title>
<meta name="keywords" content="我的收藏 - 个人中心">
<meta name="description" content="我的收藏 - 个人中心">
<body id="conch-member">
<!--海螺影视主题  https://www.360mb.net/23977.html-->
<div th:replace="header::.conch-header"></div>
<div class="conch-header">
    <div class="conch-headwrap conch-hasone conch-hasconch hl-hide-sm">
        <div class="hl-mob-nav">
            <a href="javascript:MAC.GoBack()" class="hl-pull-left left"><i class="iconfont hl-icon-jiantouzuo"></i></a>
            <a href="javascript:;" id="btnClear" class="hl-pull-right right"><i
                    class="iconfont hl-icon-lajitong"></i></a>
            <span class="hl-mob-title hl-text-site hl-lc-1">我的收藏</span>
        </div>
    </div>
</div>
<div class="conch-content conch-member">
    <div class="conch-ctwrap">
        <div class="hl-ctwrap-item">
            <div class="container">
                <div class="hl-row-box clearfix">
                    <div class="row" id="all">
                        <div th:replace="ajax_info::#left"></div>
                        <div id="right" class="hl-right-content hl-col-xs-12 hl-col-sm-70w hl-col-lg-9">
                            <div class="hl-cont-right">
                                <div class="hl-rb-head hl-hidden-xs clearfix">
                                    <h2 class="hl-rb-title">我的收藏</h2>
                                </div>
                                <div class="hl-tool-btns">
                                    <a href="javascript:;" @click="checkAll()">全选</a>
                                    <a href="javascript:;" @click="checkOthers()">反选</a>
                                    <a href="javascript:;" id="btnDel" @click="deletectidlist()">删除</a>
                                    <a href="javascript:;" id="btnClear2" @click="checkAll(),deletectidlist()">清空</a>
                                </div>
                                <ul id="collectuid" class="hl-data-list clearfix">
                                    <li class="hl-data-item" v-for="(item,key) in collects">
                                        <input name="ids[]" type="checkbox" :value="item.ctid" v-model="ctidlist" class="conch-input">
                                        <div class="hl-item-pic">
                                            <a class="hl-item-thumb hl-lazy" :href="'detail?ctid=' + item.ctid"
                                               :title="cartoonMap[item.ctid].cname"
                                               :data-original="cartoonMap[item.ctid].cimage"
                                               :style="'background-image:url('+cartoonMap[item.ctid].cimage +')'">
                                                <div class="hl-pic-icon hl-hidden-xs"><i
                                                        class="iconfont hl-icon-bofang-fill"></i></div>
                                            </a>
                                        </div>
                                        <div class="hl-item-content">
                                            <div class="hl-item-title hl-text-site hl-lc-2"><a
                                                    :href="'detail?ctid=' + item.ctid"
                                                    :title="cartoonMap[item.ctid].cname">{{cartoonMap[item.ctid].cname}}</a>
                                            </div>
                                            <div class="hl-item-sub hl-text-muted">
                                                <p class="hl-lc-1">类型：{{stringMap[item.ctid]}}</p>
                                                <p class="hl-lc-1">编号：{{item.ctid}}</p>
                                                <p class="hl-lc-1">时间：{{item.codate}}</p>
                                            </div>
                                        </div>
                                        <a class="hl-btn-del hl-btn-border"
                                           @click="deletecollect(item.ctid)"><i class="iconfont hl-icon-lajitong"></i><span
                                                class="hl-hidden-xs"> 删除</span></a>
                                    </li>
                                </ul>
                                <ul class="hl-page-wrap hl-text-center cleafix">
                                    <li class="hl-hide-sm"><a @click="query(1)" class="hl-disad"><i
                                            class="iconfont hl-icon-jiantoushou"></i></a></li>
                                    <li><a @click="query(prePage)" :class="prePage>0?'':'hl-disad'"><span
                                            class="hl-hide-sm"><i
                                            class="iconfont hl-icon-jiantouzuo"></i></span><span class="hl-hidden-xs">上一页</span></a>
                                    </li>
                                    <li class="hl-hidden-xs" v-if="curPage-1>2"><a
                                            @click="query(totalPage)">1</a></li>
                                    <li class="hl-hidden-xs hl-disad" v-if="curPage>4"><a
                                            class="hl-page-dot"
                                            href="javascript:;"><span>...</span></a></li>
                                    <li class="hl-hidden-xs" v-if="preprePage>0"><a @click="query(preprePage)">{{preprePage}}</a>
                                    </li>
                                    <li class="hl-hidden-xs" v-if="prePage>0"><a @click="query(prePage)">{{prePage}}</a>
                                    </li>
                                    <li class="hl-hidden-xs"><a @click="query(curPage)" class="active">{{curPage}}</a>
                                    </li>
                                    <li class="hl-hidden-xs" v-if="nextPage>0"><a
                                            @click="query(nextPage)">{{nextPage}}</a></li>
                                    <li class="hl-hidden-xs" v-if="nextnextPage>0"><a
                                            @click="query(nextnextPage)">{{nextnextPage}}</a></li>
                                    <li class="hl-page-tips hl-hide-sm"><a
                                            href="javascript:;">{{curPage}}&nbsp;/&nbsp;{{totalPage}}</a></li>
                                    <li class="hl-hidden-xs hl-disad" v-if="totalPage-curPage>3"><a
                                            class="hl-page-dot"
                                            href="javascript:;"><span>...</span></a></li>
                                    <li class="hl-hidden-xs" v-if="totalPage-curPage>2"><a
                                            @click="query(totalPage)">{{totalPage}}</a></li>
                                    <li :class="nextPage>0?'':'hl-disad'"><a @click="query(nextPage)"><span
                                            class="hl-hide-sm"><i
                                            class="iconfont hl-icon-jiantouyou"></i></span><span
                                            class="hl-hidden-xs">下一页</span></a></li>
                                    <li class="hl-hide-sm"><a @click="query(totalPage)"><i
                                            class="iconfont hl-icon-jiantouwei"></i></a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="js/vue.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.26.0/axios.min.js"></script>
<script type="text/javascript">
    var a = new Vue({
        el: '#all',
        data() {
            return {
                prePage: -1,
                preprePage: -1,
                curPage: -1,
                nextPage: -1,
                nextnextPage: -1,
                totalNum: -1,
                totalPage: -1,
                stringMap: [],
                cartoonMap: [],
                collects: [],
                ctidlist: [],
                messsage: {
                    ucount: '',  //账号
                    nickname: '',  //昵称
                    uscore: '',   //积分
                    password: '',  //密码
                    uimage: '',    //用户头像
                    email: '',    //邮箱
                    qq: '',       //QQ
                    registerdate: '',  //注册时间
                    lastlogineddate: '',  //最后登录时间
                    curlogindate: '',    //当前登录时间
                    ugroup: '',         //会员类型
                    deadline: '',       //会员期限
                    loginednum: ''     //登录次数
                }
            }
        },
        methods: {
            selectuser() {
                let url = "user/selectuser";
                axios.post(url).then(res => {
                    var data = res.data;
                    if (data.code == 1) {
                        this.messsage = data.data;
                    }
                })
            },
            querycollect() {
                let url = "/getcollect.do";
                var param = new URLSearchParams();
                axios.post(url, param).then(res => {
                    var data=res.data;
                    if (res.data.code == 1) {
                        this.cartoonMap = data.data['cartoonMap'];
                        this.stringMap = data.data['stringMap'];
                        this.prePage = data.data["prePage"];
                        this.preprePage = data.data["preprePage"];
                        this.curPage = data.data["curPage"];
                        this.nextPage = data.data["nextPage"];
                        this.nextnextPage = data.data["nextnextPage"];
                        this.totalNum = data.data["totalNum"];
                        this.totalPage = data.data["totalPage"];
                        this.collects = data.data["dataList"];
                    }
                })
            },
            query(page){
                var url = "getcollect.do";
                var params = new URLSearchParams();
                params.append("page",page);
                axios.post(url, params).then(res => {
                    var data = res.data;
                    if (data.code == 1) {
                        this.cartoonMap = data.data['cartoonMap'];
                        this.stringMap = data.data['stringMap'];
                        this.prePage = data.data["prePage"];
                        this.preprePage = data.data["preprePage"];
                        this.curPage = data.data["curPage"];
                        this.nextPage = data.data["nextPage"];
                        this.nextnextPage = data.data["nextnextPage"];
                        this.totalNum = data.data["totalNum"];
                        this.totalPage = data.data["totalPage"];
                        this.collects = data.data["dataList"];
                    }
                })
            },
            handleFile() {
                let files = document.getElementById('file').files;
                if (!files) {
                    return;
                }
                this.file = files[0];
                this.uploadFile();
            },
            uploadFile() {
                let formData = new FormData();
                formData.append("file", this.file);
                formData.append("uid", this.messsage.uid);
                axios({
                    url: '/uploadFile',
                    method: 'post',
                    data: formData
                }).then(res => {
                    if (res.data.code > 0) {
                        this.selectuser();
                        login.$data.user = {};
                    }
                })
            },
            deletecollect(ctid){
                let url = "collect/deletecollect";
                var params = new URLSearchParams();
                params.append("ctid",ctid);
                axios.post(url, params).then(res=>{
                    if (res.data.code == 1){
                        alert(res.data.msg);
                        this.querycollect();
                    }else{
                        alert(res.data.msg);
                    }
                })
            },
            deletectidlist(){
                let url = "collect/deletecollectList";
                var str=JSON.stringify(this.ctidlist);
                if (this.ctidlist.length > 0){
                    var params = new URLSearchParams();
                    params.append("str",str);
                    axios.post(url, params).then(res=>{
                        if (res.data.code == 1){
                            alert(res.data.msg);
                            this.querycollect();
                        }else{
                            alert(res.data.msg);
                        }
                    })
                }else{
                    alert("请选择要取消收藏的内容");
                }
            },
            checkAll(){
                this.collects.forEach(list=>{
                    this.ctidlist.push(list.ctid);
                })
            },
            checkOthers(){
                // var a=[1,2,3,4,5]
                // var b=[2,3,7,8,9]
                // var c=a.filter(item=>b.indexOf(item)==-1)
                var ctidlist=[];
                this.collects.forEach(list=>{
                    ctidlist.push(list.ctid);
                })
                this.ctidlist=ctidlist.filter(item=>this.ctidlist.indexOf(item)==-1);
            }
        },
        mounted() {
            window.querycollect = this.querycollect();
            window.selectuser = this.selectuser();
        }
    })
</script>

<!--<script type="text/javascript">-->
<!--    $(".face").imageUpload({-->
<!--        formAction: "/index.php/user/portrait.html",-->
<!--        inputFileName: 'file',-->
<!--        browseButtonValue: '<i class="iconfont hl-icon-xie"></i>',-->
<!--        browseButtonClass: 'hl-face-upload',-->
<!--        automaticUpload: true,-->
<!--        hideDeleteButton: true,-->
<!--        hover: true-->
<!--    })-->
<!--    $(".face").on("imageUpload.uploadFailed", function (ev, err) {-->
<!--        alert(err);-->
<!--    });-->
<!--</script>-->
<!--<script type="text/javascript">-->
<!--    $(".hl-tui-btn").click(function () {-->
<!--        $(".hl-tui-wrap").slideToggle("slow");-->
<!--    });-->
<!--</script>-->
<!--<script>-->
<!--    function delData(ids, all) {-->
<!--        var msg = '删除';-->
<!--        if (all == 1) {-->
<!--            msg = '清空';-->
<!--        }-->
<!--        if (confirm('确定要' + msg + '记录吗')) {-->
<!--            $.post("/index.php/user/ulog_del.html", {ids: ids, type: 2, all: all}, function (data) {-->
<!--                if (data.code == '1') {-->
<!--                    alert('删除成功');-->
<!--                    location.reload();-->
<!--                } else {-->
<!--                    alert('删除失败：' + data.msg);-->
<!--                }-->
<!--            }, 'json')-->
<!--        }-->
<!--    }-->

<!--    $("#btnClear,#btnClear2").click(function () {-->
<!--        delData('', 1);-->
<!--    });-->
<!--    $("#btnDel").click(function () {-->
<!--        var ids = MAC.CheckBox.Ids('ids[]');-->
<!--        if (ids == '') {-->
<!--            alert("请至少选择一个数据");-->
<!--            return;-->
<!--        }-->
<!--        delData(ids, 0);-->
<!--    });-->
<!--</script>-->
<!--海螺影视主题  https://www.360mb.net/23977.html-->
<div th:replace="ajax_info::.conch-footer"></div>
</body>
</html>